<template>
    <div class="login-container">
        <div class="login-card">
            <h2 class="title">用户登录</h2>


            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" class="input-field" placeholder="请输入用户名" required>
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" class="input-field" placeholder="请输入密码" required>
            </div>

            <div class="options">
                <label class="remember-me">
                    <input type="checkbox">
                    记住我
                </label>
                <a href="#" class="forgot-password">忘记密码？</a>
            </div>

        <button type="submit" class="login-btn" @click="toHome">立即登录</button>

        </div>
    </div>
</template>
<script setup>
import router from '@/router'
import { ref, reactive } from 'vue'
let path = ref("")
const toHome = () => {
    const password = document.getElementById("password")
    const username = document.getElementById("username")
    let pwd = ref(password.value)
    let unm = ref(username.value)
    console.log(pwd.value)
    
    if (pwd.value == "12345" && unm.value == "admin") {
        router.push('/home') 
    }else{
        alert("账号或密码输入错误")
    }
    
}

</script>

<style scoped>
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.title {
    text-align: center;
    color: #333;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
}

.input-field {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.input-field:focus {
    outline: none;
    border-color: #409eff;
    box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
}

.options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
}

.remember-me {
    color: #666;
    font-size: 0.9rem;
}

.forgot-password {
    color: #409eff;
    text-decoration: none;
    font-size: 0.9rem;
}

.login-btn {
    width: 100%;
    padding: 0.8rem;
    background: #409eff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.login-btn:hover {
    background: #66b1ff;
}

.divider {
    text-align: center;
    color: #999;
    position: relative;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: "";
    display: inline-block;
    width: 45%;
    height: 1px;
    background: #eee;
    vertical-align: middle;
    margin: 0 0.5rem;
}

.icons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.icon-btn:hover {
    border-color: #409eff;
    background: #f5f7fa;
}

.wechat::after {
    content: "微";
    color: #2AAC00;
}

.github::after {
    content: "Git";
    color: #333;
}

.google::after {
    content: "G";
    color: #DB4437;
}
</style>